from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_wine
from sklearn.model_selection import train_test_split

if __name__ == '__main__':
    wine = load_wine()
    x = wine.data
    y = wine.target
    X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.3, random_state=0)

    clf = DecisionTreeClassifier(random_state=0)
    rclf = RandomForestClassifier(random_state=0)
    clf.fit(X_train, y_train)
    rclf.fit(X_train, y_train)

    score_clf = clf.score(X_test, y_test)
    score_rclf = clf.score(X_test, y_test)

    print("Decision Tree Classifier：{}".format(score_clf))
    print("Random Forest Classifier：{}".format(score_rclf))
